<template>
  <div class="home">
    <h1>home</h1>
    <h2>{{token}}</h2>
    <button @click="setToken">setToken</button>
    <button @click="requestUserInfo">requestUserInfo</button>
  </div>
</template>

<script>
export default {
  name: 'home',
  data() {
    return {
      title: 'home'
    }
  },
  computed: {
    token() {
      return this.$store.getters.token
    }
  },
  methods: {
    setToken() {
      this.$store.commit('setToken','KKK')
    },
    requestUserInfo() {
      this.$store.dispatch('requestUserInfo').then(data => {
        console.log(data)
      })
    }
  },
  mounted() {
    // console.log(this.$router)
    // this.$network.get('/getTangPoetry').then(data => {
    //   console.log(data)
    // })
    // this.$request.get('/getTangPoetry', null).then( data => {
    //   console.log(data);
    // });
  }
}
</script>

<style lang="less" scoped>
.home {
  h1 {
    color: salmon;
  }
}
</style>